// 实时商品库存
const {DataTypes, db } = require("../db");
db.define('inventory', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,comment:''}, 
locationId:{type: DataTypes.INTEGER,allowNull:false,comment:'仓库'}, 
invId:{type: DataTypes.INTEGER,allowNull:false,comment:'商品ID'}, 
lastCount:{type: DataTypes.INTEGER,defaultValue:0,comment:'库存合计'}, 
lastPrice:{type: DataTypes.DECIMAL(19, 9),allowNull:false,defaultValue:0,comment:'成本单价'}, 
lastMoney:{type: DataTypes.DECIMAL(19, 2),allowNull:false,defaultValue:0,comment:'库存余额合计'}, 
inCount:{type: DataTypes.INTEGER,defaultValue:0,comment:'入库合计'}, 
inPrice:{type: DataTypes.DECIMAL(19, 9),defaultValue:0,comment:'入库单价'}, 
inMoney:{type: DataTypes.DECIMAL(19, 2),defaultValue:0,comment:'入库金额'}, 
outCount:{type: DataTypes.INTEGER,defaultValue:0,comment:'出库数量'}, 
costPrice:{type: DataTypes.DECIMAL(19, 9),comment:'成本单价'},
costMoney:{type: DataTypes.DECIMAL(19, 2),comment:'成本'}, 

}, {
    tableName: 'inventory',
    timestamps: false,
    comment: '实时商品库存'
});